package text;

import java.io.IOException;

import com.google.gson.Gson;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class Service {

	public String wwwurl = "http://api.zpzk100.com/client/product_detail?id=100";
	public String taobao( ){
		String result;
		OkHttpClient client = new OkHttpClient();
		Request request = new Request.Builder().url(wwwurl).build();
		
		
		try {
			Response res = client.newCall(request).execute();
			result = res.body().string();
		} catch (IOException e) {
			e.printStackTrace();
			result = e.getMessage();
		}
		return result;
	}
	public Object2 getObject (){
		Object2 ob = new Object2();
		Gson gson = new Gson();
		String str = taobao();
		ob = gson.fromJson(str, Object2.class);
		return ob;
	}
}
